/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Controladores;

import Entidades.Rol;
import logica.jpaControllers.RolJpaController;
import java.util.List;

public class CtrlRol {
  public CtrlRol() {
    }
   
    public void guardarRol(Rol rol) {
        RolJpaController ga = new RolJpaController();
        ga.create(rol);
    }
    
    public void eliminarRol(Rol rol) throws Exception{
        RolJpaController ga = new RolJpaController();
        ga.destroy(rol.getIdRol());
    }

    public void modificarRol(Rol rol) throws Exception {
        RolJpaController ga = new RolJpaController();
        ga.edit(rol);
    }
    
     
    public Rol buscarRol_X_idRol(int rol){
        RolJpaController ga = new RolJpaController();
        return ga.findRol(rol);
       
    }
    
    public Rol buscarRolNombre(String nom) throws Exception{
        RolJpaController ga = new RolJpaController();
        return ga.findRol_x_nombre(nom);        
    }
     
    public List buscarTodosRol() throws Exception{        
        RolJpaController ga = new RolJpaController();
        return ga.findRolEntities();
    }
  
}
